﻿@using CodeCamp.Models.Schedule
@using CodeCamp.Models.Shared
@using CodeCamp.Infrastructure.Extensions
@model ScheduleTimeslotsViewModel
@{
    ViewBag.Title = "";
    string headline;
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = @Html.Encode(@Model.EventDisplayName + " | Timeslots");
        headline = @Model.EventDisplayName + " Timeslots";
    }
    else
    {
        ViewBag.Title = "Code Camp | Timeslots";
        headline = "Code Camp Timeslots";
    }
}

<h2>@headline</h2>
<h3>(Admin Only)</h3>

<table>
    <tr><td>&nbsp;</td><th>Date</th><th>Start</th><th>End</th><th>Name</th></tr>
@foreach (var timeslot in Model.TimeSlots)
{
    <tr>
        <td>
            @if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
            {
                @Html.ActionLink("Edit", "EditTimeslot", new { eventName = Model.EventShortName, id = timeslot.Id })
            }
            else
            {
                <text>&nbsp;</text>
            }
        </td>
        <td>@timeslot.StartTime.ToShortDateString()</td>
        <td>@timeslot.StartTime.ToShortTimeString()</td>
        <td>@timeslot.EndTime.ToShortTimeString()</td>
        <td>@timeslot.Name</td>
    </tr>
}
</table>

@if (User.IsInRole(CCRoles.RoleNames.BigCheeze))
{
@Html.ActionLink("Add Timeslot", "AddTimeslot", new { eventName = Model.EventShortName })
}